<template>

    <div style="height: 95%;width: 100%;display:flex;justify-content:center;padding-top: 20px">
        <!--弹框DIV 设置弹框的大小的地方-->
        <div style="background: #fff;width: 700px;height: 600px;box-shadow: #D3DCE6 0px 0px 20px;">
            <div style="height:520px;border: #1C84C6;margin-top: 25px" class="scrollbar">
                <div style="height: 30px;">
                    <!--标题-->
                    <span style="font-size: 18px;margin-left: 25px;">
                        维修工单
                    </span>
                    <!--返回列表-->
                    <router-link style="margin-left: 530px;" :to="{path:'/wxgd'}">
                        <span>
                            <i slot="suffix" style="font-size: 30px;color: #D3DCE6" class="el-icon-close"></i>
                        </span>
                    </router-link>
                </div>
                <!--height:91%;表单在弹框显示多长-->
                <el-scrollbar style="height:91%;padding-top: 20px;">

                    <!--新增维修工单-->
                    <el-form style="margin-top:5px;margin-left: 40px;" size="mini" :model="wxgdzclist"  >
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">维修工单</span>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">工单流水号：</label><br/>
                                    <el-input v-model="wxgdzclist.gdLsh" :disabled="true"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">接单人：</label><br/>
                                    <el-select  v-model="wxgdzclist.empId" :disabled="ft"
                                               value-key="empId"
                                               style="width: 250px"
                                    >
                                        <el-option
                                                v-for="item in shohouyg"
                                                :key="item.empId"
                                                :label="item.empName"
                                                :value="item">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;" >
                                    <label slot="label" style="font-size: 13px">日期：</label><br/>
                                    <!--客户名称-->
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            v-model="wxgdzclist.gd_Jiedanrq" :disabled="ft">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">客户：</label><br/>
                                    <!--客户名称-->
                                    <el-popover
                                            style="width: 700px; height: 450px;"
                                            placement="right"
                                            trigger="click"
                                            v-model="kehu">
                                        <span style="font-size: 16px;">关联客户模块</span>
                                        <br/>
                                        <el-input @keyup.enter.native="initData" v-model="kehuinput"  style="width: 210px; margin-left: 230px; margin-bottom: 10px;">
                                            <i slot="suffix" class="el-input__icon el-icon-search" @click="initData"></i>
                                        </el-input>
                                        <el-table
                                                highlight-current-row
                                                border
                                                ref="kehulist"
                                                :data="kehulist">
                                            <el-table-column type="selection" width="50" align="center" property="clientId"></el-table-column>
                                            <el-table-column width="150" property="clientName" label="客户名称"></el-table-column>
                                            <el-table-column width="100" property="clientRank" label="级别"></el-table-column>
                                            <el-table-column width="150" property="clientMobile" label="手机号码"></el-table-column>
                                            <el-table-column width="200" property="clientSite" label="地址"></el-table-column>
                                        </el-table>
                                        <el-pagination
                                                style="margin-left: 350px;"
                                                layout="prev, pager, next"
                                                :page-size="pageSize"
                                                :current-page.sync="currPage"
                                                :total="totalSize">
                                        </el-pagination>
                                        <div style="text-align: center;width: 100%" class="dialog-footer">
                                            <el-button type="primary" @click="xzkehu">保 存</el-button>
                                            <el-button type="primary" @click="kehu = false">取 消</el-button>
                                        </div>
                                        <el-input v-model="wxgdzclist.clientId.clientName" :disabled="ft" placeholder="+添加" slot="reference" :readonly='true' style="width: 250px;"></el-input>
                                    </el-popover>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">类型：</label><br/>
                                    <el-select  placeholder="全部数据" style="width: 250px"  v-model="wxgdzclist.gdLeixing" :disabled="ft">
                                        <el-option
                                                v-for="item in options"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">联系人：</label><br/>
                                    <el-select v-model="wxgdzclist.linkmanId" :disabled="ft"
                                               value-key="linkmanId"
                                               style="width: 250px"
                                               @change="xzlxrfz"
                                               >
                                        <el-option
                                                v-for="item in lxrlist"
                                                :key="item.linkmanId"
                                                :label="item.linkmanName"
                                                :value="item">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px" >电话：</label><br/>
                                    <el-input v-model="wxgdzclist.gdxbId[0].gdDh" :disabled="ft"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">地址：</label><br/>
                                    <textarea  style="width: 250px;" v-model="wxgdzclist.gdxbId[0].gdDizhi" :disabled="ft"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <hr style="border:0.6px solid #EEEEEE;width: 96%;width:74%;float: left">

                        <!--接单详情-->
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">接单详情</span>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;" >
                                    <label slot="label" style="font-size: 13px">订单：</label><br/>

                                    <el-select v-model="wxgdzclist.orderId" :disabled="ft"
                                               value-key="orderId"
                                               style="width: 250px"
                                               @change="xzdd"
                                    >
                                        <el-option
                                                v-for="item in ddlist"
                                                :key="item.orderId"
                                                :label="item.orderNo"
                                                :value="item">
                                        </el-option>
                                    </el-select>


                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px" >
                                    <label slot="label" style="font-size: 13px">产品：</label><br/>
                                    <el-select v-model="wxgdzclist.prodetailId.productName" :disabled="ft"
                                               @change="xzcp"
                                               style="width: 250px"
                                    >
                                        <el-option
                                                v-for="item in cplist"
                                                :key="item.prodetailId.prodetailId"
                                                :label="item.prodetailId.productName"
                                                :value="item">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="3">
                                <el-form-item style="width:100%;">
                                    <label slot="label" style="font-size: 13px;">保修：</label>
                                </el-form-item>
                            </el-col>
                            <el-col :span="21">
                                <el-form-item style="width:100%;">
                                    <template>
                                        <el-radio-group v-model="wxgdzclist.gdBaoxiu" :disabled="ft">
                                            <el-radio :label='"在保"'>在保</el-radio>
                                            <el-radio :label='"出保"'>出保</el-radio>
                                        </el-radio-group>
                                    </template>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;" >
                                    <label slot="label" style="font-size: 13px">商品销售日期：</label><br/>
                                    <!--客户名称-->
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            v-model="wxgdzclist.gdxbId[0].gdSpxsrq" :disabled="ft">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px" >
                                    <label slot="label" style="font-size: 13px">接单状况：</label><br/>
                                    <el-input  v-model="wxgdzclist.gdxbId[0].gdJdzk" :disabled="ft"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">故障描述：</label><br/>
                                    <textarea  style="width: 250px;" v-model="wxgdzclist.gdxbId[0].gdGuzhangmiaoshu" :disabled="ft"></textarea>
                                </el-form-item>
                            </el-col>

                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">注意事项：</label><br/>
                                    <textarea  style="width: 250px;" v-model="wxgdzclist.gdxbId[0].gdZhuyishixiang" :disabled="ft"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;" >
                                    <label slot="label" style="font-size: 13px">承接部门：</label><br/>
                                    <el-select  placeholder="全部数据" style="width: 250px"   v-model="wxgdzclist.gdChengjiebumen" :disabled="ft">
                                        <el-option
                                                v-for="item in shohoubm"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.label"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>

                        </el-row>

                        <hr style="border:0.6px solid #EEEEEE;width: 96%;width:74%;float: left">

                        <!--接单详情-->
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">费用与执行</span>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">费用：</label><br/>
                                    <el-input  v-model="wxgdzclist.gdxbId[0].gdMoney" :disabled="ft"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">已收款：</label><br/>
                                    <el-input v-model="wxgdzclist.gdxbId[0].gdYishoumoney" :disabled="true"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="3">
                                <el-form-item style="width:100%;">
                                    <label slot="label" style="font-size: 13px;">状态：</label>
                                </el-form-item>
                            </el-col>
                            <el-col :span="21">
                                <el-form-item style="width:100%;">
                                    <template>
                                        <el-radio-group v-model="wxgdzclist.gdZhuangtai" :disabled="ft">
                                            <el-radio :label='"执行中"'>执行中</el-radio>
                                            <el-radio :label='"结束"'>结束</el-radio>
                                            <el-radio :label='"意外终止"'>意外终止</el-radio>
                                        </el-radio-group>
                                    </template>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">备注：</label><br/>
                                    <textarea  style="width: 250px;" v-model="wxgdzclist.gdxbId[0].gdBeizhu" :disabled="ft"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row :gutter="24" v-show="bj">
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="bianjian" @click="bianji()">编辑</el-button>
                                <el-button type="info" style="width: 140px" v-show="queran" @click="xgwxd()">确认</el-button>
                            </el-col>
                            <el-col :span="12" >
                                <el-button type="info" style="width: 140px" v-show="ksjcan" @click="ksjcff()">开始检测</el-button>
                            </el-col>
                        </el-row>
                    </el-form>

                    <!--检测过程表单-->
                    <el-form style="margin-top:5px;margin-left: 40px;" size="mini"  v-show="jiance" :model="addjianchelist" >
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">检测人员 检测过程</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">预计维修天数：</label><br/>
                                    <el-input :disabled="jcbd" v-model="addjianchelist.jcWxday" ></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">检测人员：</label><br/>
                                    <el-input :disabled="jcbd" v-model="addjianchelist.jcYgname"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">检测开始日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            :disabled="jcbd"
                                            v-model="addjianchelist.jcKstime"
                                            >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">检测完成日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            :disabled="jcbd"
                                            v-model="addjianchelist.jcWctime"
                                           >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">检测说明：</label><br/>
                                    <textarea  style="width: 250px;" :disabled="jcbd"  v-model="addjianchelist.jcShuoming"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row :gutter="24" v-show="jcan">
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="jcanbj" @click="jiancbjff">编辑</el-button>
                                <el-button type="info" style="width: 140px" v-show="jcanquer" @click="addjiance()">确认</el-button>
                            </el-col>
                            <el-col :span="12" >
                                <el-button type="info" style="width: 140px" v-show="jcanwcan" @click="jiancwc()">检测完成</el-button>
                            </el-col>
                        </el-row>
                    </el-form>

                    <!--客户确认-->
                    <el-form style="margin-top:5px;margin-left: 40px;" size="mini"  v-show="khqr" :model="addkhqrlist" >
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">接单人员 客户确认</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">确认日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            v-model="addkhqrlist.qrRq"
                                            :disabled="true"
                                    >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">确认人员：</label><br/>
                                    <el-input :disabled="true" v-model="addkhqrlist.qrYgname"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">沟通要点：</label><br/>
                                    <textarea  style="width: 250px;" v-model="addkhqrlist.qrGtyd" :disabled="qr"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row :gutter="24" v-show="khqueren">
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="khquerenbj" @click="khquerenbjff">编辑</el-button>
                                <el-button type="info" style="width: 140px" v-show="querenaniu" @click="querenaniuff()">确认</el-button>
                            </el-col>
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="querenaniuwc"  @click="querenaniuwcff()">确认维修</el-button>
                            </el-col>
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="querenaniuwc"  @click="querenbuiuwcff()">确认不维修</el-button>
                            </el-col>
                        </el-row>
                    </el-form>

                    <!--维修过程维-->
                    <el-form style="margin-top:5px;margin-left: 40px;" size="mini"  v-show="wxgc" :model="addwxgclist" >
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">维修人员 维修过程</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">维修开始日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            v-model="addwxgclist.gcYjtime"
                                            :disabled="true"
                                    >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">维修人员：</label><br/>
                                    <el-input :disabled="true" v-model="addwxgclist.gcYgname"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">维修完成日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            v-model="addwxgclist.gcWxwctime"
                                            :disabled="gc"
                                    >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">维修备注：</label><br/>
                                    <textarea  style="width: 250px;" :disabled="gc" v-model="addwxgclist.gcWxbz" ></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>


                        <el-row :gutter="24" v-show="kaishiweixiu">
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="kswx" @click="kswxff()">开始维修</el-button>
                                <el-button type="info" style="width: 140px" v-show="cxkswxq" @click="cxkswxqff()">撤销到维修前</el-button>
                                <el-button type="info" style="width: 140px" v-show="qrkswx" @click="qrkswxff()">确认</el-button>
                            </el-col>
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="kswxbj" @click="kswxbjff()">编辑</el-button>
                            </el-col>
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="wxwcan" @click="wxwcanff()">维修完成</el-button>
                            </el-col>
                        </el-row>
                    </el-form>

                    <!--交付-->
                    <el-form style="margin-top:5px;margin-left: 40px;" size="mini"  v-show="jiafu" :model="addjiaofulist" >
                        <el-row>
                            <el-col>
                                <el-form-item style="width:250px;">
                                    <div class="shugan"></div>
                                    <span style="margin-left: 10px;font-size: 14px;">接单人员交付</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">客户接收人：</label><br/>
                                    <el-input :disabled="jf" v-model="addjiaofulist.jfKhjieshouru"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">经手人：</label><br/>
                                    <el-input :disabled="true" v-model="addjiaofulist.jfJinshouren"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>
                            <el-col :span="10">
                                <el-form-item style="width:250px;">
                                    <label slot="label" style="font-size: 13px">交付日期：</label><br/>
                                    <el-date-picker
                                            type="datetime"
                                            placeholder="选择日期"
                                            style="width: 250px"
                                            :disabled="jf"
                                            v-model="addjiaofulist.jfDate"
                                    >
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item style="width:250px">
                                    <label slot="label" style="font-size: 13px">交付备注：</label><br/>
                                    <textarea  style="width: 250px;" :disabled="jf" v-model="addjiaofulist.jfBeizhu"></textarea>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row :gutter="24" v-show="jiaofu">
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="jiaofubj" @click="jiaofubjff()">编辑</el-button>
                                <el-button type="info" style="width: 140px" v-show="jiaofuqd" @click="jiaofuqdff()">确定</el-button>
                            </el-col>
                            <el-col :span="5" >
                                <el-button type="info" style="width: 140px" v-show="qujian" @click="qujianff()">联系客户取件</el-button>
                                <el-button type="info" style="width: 140px" v-show="jiaofukh" @click="jiaofukhff()">交付给客户</el-button>
                                <el-button type="info" style="width: 140px" v-show="cxjiaofu" @click="cxjiaofuff()">撤销交付</el-button>
                            </el-col>
                        </el-row>
                    </el-form>

                </el-scrollbar>







                <!--确定按钮 设置了固定定位-->
                <div style="text-align: center;width: 80%;position: absolute;top:655px;left:230px;" class="dialog-footer" v-show="xshi">
                    <!--返回列表-->
                    <router-link :to="{path:'/wxgd'}">
                        <el-button >取 消</el-button>
                    </router-link>
                    &nbsp;&nbsp;
                    <el-button type="primary"   @click="addwxd()">确 定</el-button>
                </div>
            </div>
        </div>
    </div>


</template>

<script>
    export default {
        name: "Lwxgdtk",
        data() {
            return {
                options:[{
                    value: '产品销售',
                    label: '产品销售'
                }, {
                    value: '服务',
                    label: '服务'
                }, {
                    value: '业务合作',
                    label: '业务合作'
                }, {
                    value: '代理分销',
                    label: '代理分销'
                }, {
                    value: '其他',
                    label: '其他'
                }],
                optionss:[{
                    value: '维修一部',
                    label: '维修一部'
                }],
                wxgdzclist:{
                    gdId:0,
                    gdLsh:'',
                    gd_Jiedanrq:'',
                    gdLeixing:'',
                    gdChengjiebumen:'',
                    gdZhuangtai:'',
                    gdBaoxiu:'',
                    gdJingdu:'待检测',
                    gdLuojisc:1,
                    clientId: {
                        clientId:'',
                        clientName:''
                    },//客户对象（客户id）
                    linkmanId: '',//联系人对象（联系人id）
                    orderId: '',//订单对象（订单id）
                    prodetailId: {
                        prodetailId:'',
                        productName:'',
                    },//产品对象（产品id）
                    empId: '',//员工对象（产品id）
                    //维修从表
                    gdxbId:[{
                        gdxbId:0,//工单从表id
                        gdDh:'',//联系人电话
                        gdDizhi:'',//地址
                        gdSpxsrq:'',//产品销售日期
                        gdGuzhangmiaoshu:'',//故障描述
                        gdZhuyishixiang:'',//注意事项
                        gdMoney:'',//维修费用
                        gdYishoumoney:0,//已收款
                        gdBeizhu:'',//备注
                        gdJdzk:'',//接单状况
                    }],
                },
                //检测表单
                addjianchelist:{
                    jcId:0,//检测id
                    jcShuoming:'',//检测说明
                    jcWxday:'',//预计维修天数
                    jcKstime:'',//检测开始日期
                    jcWctime:'',//检测完成日期
                    jcYgname:'',//检测人员
                    lwxzb:'',//维修主表对象
                },
                //客户确认表单
                khqueren:false,
                khquerenbj:false,
                querenaniu:false,
                querenaniuwc:false,
                qr:true,
                wxwcan:false,
                addkhqrlist:{
                    qrId:0,//客户确认id
                    qrGtyd:'',//沟通要点
                    qrRq:new Date(),//日期
                    qrYgname:'',//检测人员
                    lwxzb:''
                },
                //维修过程表单
                kaishiweixiu:false,
                kswx:false,
                cxkswxq:false,
                kswxbj:false,
                gc:true,
                qrkswx:false,
                addwxgclist:{
                    gcId:0,//维修过程id
                    gcWxbz:'',//维修备注
                    gcYjtime:new Date(),//预计完成日期
                    gcWxwctime:'',//维修完成日期
                    gcDqzt:'',//当前状态
                    gcYgname:'',//员工
                    lwxzb:''
                },
                //交付客户表单
                jiaofu:false,
                jiaofubj:false,
                jiaofuqd:false,
                cxjiaofu:false,
                jf:true,
                qujian:false,
                jiaofukh:false,
                addjiaofulist:{
                    jfId:0,//交付id
                    jfKhjieshouru:'',//客户接收入
                    jfJinshouren:'',//经手人
                    jfDate:'',//交付日期
                    jfBeizhu:'',//当前状态
                    lwxzb:''
                },
                pageSize:5,//客户分页页大小
                currPage:1,//客户当前页码，默认为1
                totalSize:0,//客户总记录数
                hxkkehu:0,//回款页面绑定客户查询
                kehulist:[],//客户表格信息
                kehu:false,//客户弹出框
                kehuinput:'',//客户弹框搜索框
                hueikuanlist:[],//回款表格信息

                //根据客户查询联系人
                lxrlist:[],
                //根据客户查询订单
                ddlist:[],//订单对象
                cplist:[],//产品对象
                jcbd:true,//是否编辑
                xshi:true,//新增确认取消按钮显隐
                ft:false,//编辑是否可以改动维修工单
                jiance:false,//检测表单显隐
                bj:false,//编辑维修工单按钮显隐
                bianjian:false,//编辑按钮显隐
                queran:false,//编辑确认按钮显隐
                jcan:false,//
                jcanbj:false,//编辑检测按钮显隐
                jcanquer:false,//检测确认按钮显隐
                ksjcan:false,//编辑开始检测按钮显隐
                jcanwcan:false,//检测完成按钮显隐
                khqr:false,//客户确认表单显隐
                wxgc:false,//完成维修表单显隐
                jiafu:false,//完成交付表单显隐
                shohouyg:{},
                shohoubm:{},
            };
        },
        methods:{

            //查询售后部门员工
            shohouygg(){
                this.$axios.get("http://localhost:8088/vue/shohouyg").then(v=>{
                    this.shohouyg = v.data.shohouyg
                }).catch();
            },
            //查询售后部门员工
            shohoubmm(){
                this.$axios.get("http://localhost:8088/vue/shohoubm").then(v=>{
                    this.shohoubm = v.data.shohoubm
                }).catch();

            },
            //新增修改交付
            addjiaofu(){
                this.$axios.post("http://localhost:8088/vue/addjiaofu",{
                    jfId:this.addjiaofulist.jfId,
                    jfKhjieshouru:this.addjiaofulist.jfKhjieshouru,
                    jfJinshouren:this.addjiaofulist.jfJinshouren,
                    jfDate:this.addjiaofulist.jfDate,
                    jfBeizhu:this.addjiaofulist.jfBeizhu,
                    lwxzb:this.wxgdzclist
                }).then(()=>{
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: '编辑成功!',
                    });
                }).catch(()=>{
                    this.$message({
                        showClose: true,
                        message: '编辑失败',
                        type: 'error'
                    });
                })
            },
            //编辑交付
            jiaofubjff(){
                this.jiaofubj=false;
                this.jiaofuqd=true;
                this.cxjiaofu=false;
                this.jiaofukh=false;
                this.jf=false;
                this.khqrcx();
                this.jiancecha();
                this.wxgccx();
                this.jiaofucx();
            }, //确定交付按钮
            jiaofuqdff(){
                this.addjiaofu();
                this.jiaofubj=true;
                this.cxjiaofu=true;
            },
            //联系客户取件方法
            qujianff(){
                this.jiaofu=true;
                this.jiaofubj=true;
                this.jiaofuqd=false;
                this.qujian=false;
                this.qujian=false;
                this.cxjiaofu=false;
                this.jiaofukh=true;
                this.wxgdzclist.gdJingdu='待交付'
                this.bjwxgd();
            },
            //联系客户取件方法
            jiaofukhff(){
                this.jiaofu=true;
                this.jiaofubj=true;
                this.jiaofukh=false;
                this.jiaofukh=false;
                this.cxjiaofu=true;
                this.jiaofuqd=false;
                this.wxgdzclist.gdJingdu='已交付'
                this.bjwxgd();
            },
            //联系客户取件方法
            cxjiaofuff(){
                this.jiaofu=true;
                this.jiaofubj=false;
                this.jiaofukh=true;
                this.cxjiaofu=false;
                this.jiaofuqd=false;
                this.wxgdzclist.gdJingdu='待交付'
                this.bjwxgd();
            },
            //开始维修
            kswxff(){
                this.kswx=false;
                this.cxkswxq=true;
                this.kswxbj=true;
                this.wxwcan=true;
                this.wxgdzclist.gdJingdu='维修中'
                this.bjwxgd();
                this.wxgccx();
            },
            //撤销到维修前
            cxkswxqff(){
                this.kswx=true;
                this.cxkswxq=false;
                this.kswxbj=false;
                this.wxwcan=false;
            },
            //编辑
            kswxbjff(){
                this.khqrcx();
                this.jiancecha();
                this.wxgccx();
                this.jiaofucx();
                this.gc=false;
                this.cxkswxq=false;
                this.kswxbj=false;
                this.qrkswx=true;
                this.wxwcan=false;
            },
            //维修完成
            wxwcanff(){
                this.wxgdzclist.gdJingdu='修理完成'
                this.bjwxgd();
                this.kswxbj=false;
                this.qrkswx=false;
                this.wxwcan=false;
                this.cxkswxq=false;
                this.jiafu=true;
                this.jiaofu=true;
                this.qujian=true;
            },
            //确认修改
            qrkswxff(){
                this.cxkswxq=true;
                this.kswxbj=true;
                this.qrkswx=false;
                this.wxwcan=true;
                this.gc=true;
                this.$axios.post("http://localhost:8088/vue/addwxgc",{
                    gcId:this.addwxgclist.gcId,
                    gcWxbz:this.addwxgclist.gcWxbz,
                    gcYjtime:this.addwxgclist.gcYjtime,
                    gcWxwctime:this.addwxgclist.gcWxwctime,
                    gcDqzt:this.addwxgclist.gcDqzt,
                    gcYgname:this.addwxgclist.gcYgname,
                    gdLuojisc:this.addwxgclist.gdLuojisc,
                    lwxzb:this.wxgdzclist
                }).then(()=>{
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: '编辑成功!',
                    });
                }).catch(()=>{
                    this.$message({
                        showClose: true,
                        message: '编辑失败',
                        type: 'error'
                    });
                })


            },
            //客户确认
            //编辑
            khquerenbjff(){
                this.khqueren=true;
                this.khquerenbj=false;
                this.querenaniu=true;
                this.querenaniuwc=false;
                this.qr=false;
                this.khqrcx();
                this.jiancecha();
                this.wxgccx();
                this.jiaofucx();
            },

            //查询维修过程信息
            wxgccx(){
                this.$axios.get("http://localhost:8088/vue/wxgccx",{params:{gcbid:this.wxgdzclist.gdId}}).then(v=>{
                    if(v.data[0]!=null){
                        this.addwxgclist=v.data[0];
                    }

                }).catch();
            },
            //查询客户确认信息
            khqrcx(){
                this.$axios.get("http://localhost:8088/vue/khqrcx",{params:{qrbid:this.wxgdzclist.gdId}}).then(v=>{
                    if(v.data[0]!=null){
                        this.addkhqrlist=v.data[0];
                        this.addkhqrlist.qrJg='确认中'
                    }

                }).catch();
            },
            //查询检测信息
            jiancecha(){
                this.$axios.get("http://localhost:8088/vue/jianchecx",{params:{jcbid:this.wxgdzclist.gdId}}).then(v=>{
                    if(v.data[0]!=null){
                        this.addjianchelist=v.data[0];
                    }
                }).catch();
            },
            //查询维修过程信息
            jiaofucx(){
                this.$axios.get("http://localhost:8088/vue/jiaofucx",{params:{gcbid:this.wxgdzclist.gdId}}).then(v=>{
                    if(v.data[0]!=null){
                        this.addjiaofulist=v.data[0];
                    }

                }).catch();
            },
            //新增修改客户确认
            querenaniuff(){
                this.khqueren=true;
                this.khquerenbj=true;
                this.querenaniu=false;
                this.querenaniuwc=true;
                this.qr=true;

            },
            //确定是否维修新增
            addxgweixiu(){
                this.wxgc=true;
                this.khqueren=false;
                this.$axios.post("http://localhost:8088/vue/addkhqr",{
                    qrId:this.addkhqrlist.qrId,
                    qrGtyd:this.addkhqrlist.qrGtyd,
                    qrJg:this.addkhqrlist.qrJg,
                    qrRq:this.addkhqrlist.qrRq,
                    qrYgname:this.addkhqrlist.qrYgname,
                    lwxzb:this.wxgdzclist
                }).then(()=>{
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: '确定成功!',
                    });
                }).catch(()=>{
                    this.$message({
                        showClose: true,
                        message: '确定失败',
                        type: 'error'
                    });
                })
            },
            //确认维修
            querenaniuwcff(){
                this.wxgdzclist.gdJingdu='待维修'
                this.bjwxgd();
                this.addxgweixiu();
                this.kaishiweixiu=true;
                this.kswx=true;
                this.gc=true;

            }, //确认不维修
            querenbuiuwcff(){
                this.wxgdzclist.gdJingdu='待交付'
                this.bjwxgd();
                this.addxgweixiu();
                this.wxgc=false;
                this.jiafu=true;
            },
            //开始检测方法
            ksjcff(){
                this.bj=false;
                this.jiance=true;
                this.ksjcan=false;
                this.jcan=true;
                this.jcanbj=true;
                this.jcanwcan=true;
                this.jcan=true;

            },
            //新增修改检测表
            addjiance(){
                this.jcanbj=true;
                this.jcanwcan=true;
                this.jcanquer=false;
                this.jcbd=true;

                this.$axios.post("http://localhost:8088/vue/addjianche",{
                    jcId:this.addjianchelist.jcId,
                    jcShuoming:this.addjianchelist.jcShuoming,
                    jcWxday:this.addjianchelist.jcWxday,
                    jcKstime:this.addjianchelist.jcKstime,
                    jcWctime:this.addjianchelist.jcWctime,
                    jcYgname:this.addjianchelist.jcYgname,
                    lwxzb:this.wxgdzclist
                }).then(()=>{
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: '编辑成功!',
                    });
                }).catch(()=>{
                    this.$message({
                        showClose: true,
                        message: '编辑失败',
                        type: 'error'
                    });
                })
            },
            //检测编辑方法
            jiancbjff(){
                this.jcbd=false;
                this.jcanbj=false;
                this.jcanwcan=false;
                this.jcanquer=true;
                this.khqrcx();
                this.jiancecha();
                this.wxgccx();
                this.jiaofucx();
            },
            //检测完成方法
            jiancwc(){
                this.wxgdzclist.gdJingdu='待与客户确认'
                this.bjwxgd();
                this.jcanwcan=false;
                this.jcanbj=false;
                this.khqr=true;
                this.khqueren=true;
                this.khquerenbj=true;
                this.querenaniuwc=true;
            },
            //编辑维修工单
            xgwxd(){
                this.bjwxgd();
                this.bj=true;
                this.ksjcan=true;
                this.bianjian=true;
                this.ft=true;
                this.queran=false;
            },
            //修改维修工单
            bjwxgd(){
                this.$axios.post("http://localhost:8088/vue/addwxzcb",{
                    gdId:this.wxgdzclist.gdId,
                    gdLsh:this.wxgdzclist.gdLsh,
                    gd_Jiedanrq:this.wxgdzclist.gd_Jiedanrq,
                    gdLeixing:this.wxgdzclist.gdLeixing,
                    gdChengjiebumen:this.wxgdzclist.gdChengjiebumen,
                    gdZhuangtai:this.wxgdzclist.gdZhuangtai,
                    gdBaoxiu:this.wxgdzclist.gdBaoxiu,
                    gdJingdu:this.wxgdzclist.gdJingdu,
                    gdLuojisc:this.addwxgclist.gdLuojisc,
                    clientId: this.wxgdzclist.clientId,
                    linkmanId: this.wxgdzclist.linkmanId,
                    orderId: this.wxgdzclist.orderId,
                    prodetailId: this.wxgdzclist.prodetailId,
                    empId: this.wxgdzclist.empId,
                    gdxbId:this.wxgdzclist.gdxbId
                }).then(()=>{
                    this.$message({
                        showClose: true,
                        type: 'success',
                        message: '编辑成功!',
                    });
                }).catch(()=>{
                    this.$message({
                        showClose: true,
                        message: '编辑失败',
                        type: 'error'
                    });
                })
            },
            //新增维修工单
            addwxd(){

                window.console.log("this.wxgdzclist",this.wxgdzclist)
                    this.$axios.post("http://localhost:8088/vue/addwxzcb",{
                        gdId:this.wxgdzclist.gdId,
                        gdLsh:this.wxgdzclist.gdLsh,
                        gd_Jiedanrq:this.wxgdzclist.gd_Jiedanrq,
                        gdLeixing:this.wxgdzclist.gdLeixing,
                        gdChengjiebumen:this.wxgdzclist.gdChengjiebumen,
                        gdZhuangtai:this.wxgdzclist.gdZhuangtai,
                        gdBaoxiu:this.wxgdzclist.gdBaoxiu,
                        gdJingdu:this.wxgdzclist.gdJingdu,
                        clientId: this.wxgdzclist.clientId,
                        linkmanId: this.wxgdzclist.linkmanId,
                        orderId: this.wxgdzclist.orderId,
                        prodetailId: this.wxgdzclist.prodetailId,
                        empId: this.wxgdzclist.empId,
                        gdLuojisc:this.addwxgclist.gdLuojisc,
                        gdxbId:this.wxgdzclist.gdxbId
                            }).then(()=>{
                                this.$message({
                                    showClose: true,
                                    type: 'success',
                                    message: '新增成功!',
                                });
                                this.$router.push({
                                    path:'/wxgd'
                                });
                        }).catch(()=>{
                        this.$message({
                            showClose: true,
                            message: '编辑失败',
                            type: 'error'
                        });
                    })
            },
            //工单号
            danhao(){
                let yy = new Date().getFullYear();
                let mm = new Date().getMonth()+1;
                let dd = new Date().getDate();
                let hh = new Date().getHours();
                let mf = new Date().getMinutes()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes();
                let ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds();
                let dh = 'WXGD'+yy+mm+dd+hh+mf+ss+1;
                this.wxgdzclist.gdLsh = dh;
            },

            //选择客户确定按钮
            xzkehu() {
                this.$refs.kehulist.selection.forEach((pro)=>{
                    this.wxgdzclist.clientId=pro;
                });
                this.kehu=false;
                this.kehuinput='';
                this.lxrcx();
                this.ddcx();
            },
            lxrcx(){
                //根据选择的客户查询客户所有的联系人
                this.$axios.post("http://localhost:8088/vue/lxr",
                    this.qs.stringify({khname:this.wxgdzclist.clientId.clientId}))
                    .then(v2=>{
                        this.lxrlist =v2.data
                    })

            },
            ddcx(){
                //根据选择的客户查询所以订单
                this.$axios.post("http://localhost:8088/vue/ddcx",
                    this.qs.stringify({ddname:this.wxgdzclist.clientId.clientId}))
                    .then(v3=>{
                        this.ddlist =v3.data
                    })
            },
            //选择联系人
            xzlxrfz(l){
                window.console.log(11111111)
                window.console.log(l)
                this.wxgdzclist.gdxbId[0].gdDizhi = l.linkmanSite
                //联系人电话
                this.wxgdzclist.gdxbId[0].gdDh= l.linkmanMobile
            },
            //选择订单查产品
            xzdd(l){
                //根据选择的订单查询产品
                this.$axios.post("http://localhost:8088/vue/cpcx",
                    this.qs.stringify({cpname:l.orderId}))
                    .then(v4=>{
                        this.cplist =v4.data
                    })
            },


            xzcp(l){
                this.wxgdzclist.prodetailId = l.prodetailId
            },
            //客户查询方法
            initData(){
                this.$axios.post("http://localhost:8088/client-list",this.qs.stringify(
                    {search:this.kehuinput, page:this.currPage, size:this.pageSize}))
                    .then(v=>{
                        this.kehulist = v.data.rows;
                        this.totalSize = v.data.total;
                    })
                    .catch()
            },
            panduan(){
                if(this.wxgdzclist.gdJingdu=='待检测'){
                    this.bj=true;
                    this.ksjcan=true;
                    this.bianjian=true;
                }else  if(this.wxgdzclist.gdJingdu=='待与客户确认'){
                    this.jiance=true;
                    this.jcan=true;
                    this.jcanbj=false;
                    this.jcanwcan=false;
                    this.khqr=true;
                    this.khqueren=true;
                    this.khquerenbj=true;
                    this.querenaniuwc=true;
                }else  if(this.wxgdzclist.gdJingdu=='待维修'){
                    this.jiance=true;
                    this.khqr=true;
                    this.wxgc=true;
                    this.wxgc=true;
                    this.kaishiweixiu=true;
                    this.kswx=true;
                }else  if(this.wxgdzclist.gdJingdu=='维修中'){
                    this.jiance=true;
                    this.khqr=true;
                    this.wxgc=true;
                    this.kaishiweixiu=true;
                    this.cxkswxq=true;
                    this.kswxbj=true;
                    this.wxwcan=true;
                }else  if(this.wxgdzclist.gdJingdu=='修理完成'){
                    this.jiance=true;
                    this.khqr=true;
                    this.wxgc=true;
                    this.jiafu=true;
                    this.jiaofu=true;
                    this.qujian=true;
                }else  if(this.wxgdzclist.gdJingdu=='待交付'){
                    this.jiance=true;
                    this.khqr=true;
                    this.wxgc=true;
                    this.jiafu=true;
                    this.jiaofu=true;
                    this.jiaofukh=true;
                }else  if(this.wxgdzclist.gdJingdu=='已交付'){
                    alert(1)
                }else  if(this.wxgdzclist.gdJingdu=='已完成'){
                    alert(1)
                }
            },
            bianji(){
                this.ksjcan=false;
                this.bianjian=false;
                this.ft =false;
                this.queran =true;
            }


     },
        created:function() {
            this.danhao()
            this.initData()
            if(this.$route.query.key!=null){
                this.wxgdzclist=this.$route.query.key;
                window.console.log(this.$route.query.key)
                this.addkhqrlist.qrYgname=this.$route.query.key.empId.empName
                this. addwxgclist.gcYgname=this.$route.query.key.empId.empName
                this.addjiaofulist.jfJinshouren=this.$route.query.key.empId.empName
                this.lxrcx();
                this.ddcx();
                this.ft = true;
                this.xshi=false;
                this.khqrcx();
                this.jiancecha();
                this.wxgccx();
                this.jiaofucx();
                this.panduan();
            }

            if(this.$route.query.key1!=null){
                this.wxgdzclist = this.$route.query.key1;

            }
            this.shohouygg();
            this.shohoubmm();

        },

    }
</script>
<style scoped>
    .shugan{
        border-left-color: rgb(70, 205, 207);
        border-left-width: 1.8px;
        height: 10px;
        border-left-style: solid;
        display: inline;
        font-size: 13px;
    }

    /deep/ .el-scrollbar__wrap {
        overflow: scroll;
        width: 120%;
        height: 100%;
    }


</style>